﻿package{		import flash.display.Sprite;	import flash.events.Event;	import flash.events.MouseEvent;		public class box extends Sprite{		public function box(n:int){			name='box'+n;			bg.alpha=.25;			tf.mouseEnabled=false;			bg.addEventListener(MouseEvent.MOUSE_OVER,handleMouse);			bg.addEventListener(MouseEvent.MOUSE_OUT,handleMouse);			bg.addEventListener(MouseEvent.MOUSE_DOWN,handleMouse);			addEventListener(Event.ADDED_TO_STAGE,init);		}				function init(e:Event){			root.addEventListener('test',handleTest);		}				function handleMouse(e:MouseEvent){			switch(e.type){				case MouseEvent.MOUSE_OVER:					bg.alpha=1;					break;				case MouseEvent.MOUSE_OUT:					bg.alpha=.25;					break;				case MouseEvent.MOUSE_DOWN:					dispatchEvent(new Event('test',true));					break;			}		}		function handleTest(e:Event){			if(e.target==this)				tf.text="It's me!";			else				tf.text=e.target.name;		}	}}